package CAO2Demo.重写toString打印;

public class Dog {
    String name;
    String color;
    int age;

    public Dog(String name, String color, int age) {
        this.name = name;
        this.color = color;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Dog{" +
                "name='" + name + '\'' +
                ", color='" + color + '\'' +
                ", age=" + age +
                '}';
    }
}
class run1 {
    public static void main(String[] args) {
        Dog dog = new Dog("doggy","brown",4);
        System.out.println(dog);
    }
}
